package XML;

import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.URIResolver;
import javax.xml.transform.stream.StreamSource;
import java.io.IOException;
import java.net.URL;

/**
 * Created by IntelliJ IDEA.
 * User: Zlobec
 * Date: 08.02.2006
 * Time: 14:19:14
 * To change this template use File | Settings | File Templates.
 */
public class WmlURIResolver implements URIResolver {




    public Source resolve(String href, String base) throws TransformerException {
        System.err.println("href="+href);
        System.err.println("base="+base);
        StreamSource source = null;
        if(href.equalsIgnoreCase("http://www.wapforum.org/DTD/wml_1.1.xml"))

           {
             URL xmlURL = getClass().getClassLoader().getResource("DTD/wml_1.1.xml");
               try {
                   source = new StreamSource(xmlURL.openStream());
               } catch (IOException e) {
                   e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
               }



           }



        return source;  //To change body of implemented methods use File | Settings | File Templates.
    }
}
